<template>
  <div class="login">
        <section class='loginCon'>
            <div class="imgTu">
                  
            </div>
            <div class="loginBox">  
                <div></div>
                <div>请您重新从工作台登录</div>

            </div>
        </section>

  </div>
</template>

<script>
  import Vue from 'vue'
  import { Form, Alert, Button, Input, FormItem} from 'element-ui' 
  import Bus from '@/common/js/vueBus.js';
  Vue.use(Form)
  Vue.use(Alert)
  Vue.use(Button)
  Vue.use(Input)
  Vue.use(FormItem)
  export default {
    name: 'login',
    data(){
    return {
      loginForm:{
        user:"",
        pass:"",
        check:""
      },
      dialogVisible: false,
      chang:true,
      chang2:false,
      inputText:'',
      reUserMess:'',
      rePassMess:'',
      reCheckMess:'',
      checkImgSrc:'',
      errShow:false,
      rePass:false,
      message:'',
      loginState:'登录',
      isLogining:false,
      token:'',
      ishidecode:false,
    }
  },
  methods:{
    checkEnter:function(){
      this.submitForm();
    },
    rePassEve(){
      this.rePass=!this.rePass;
    },
    submitForm(){
    //   if(this.isLogining){
    //     return;
    //   }
      var self = this;
      //初步判断输入框内容
      self.errShow=false;
//       "token":self.token
//      "verifycode":self.loginForm.check,
      let params = {
        "userid":self.loginForm.user,
				"password":'1',
       
      };
      // http://10.5.0.137:8080/home/login
      this.Axios.Post(
        this.URL.login.url,
        params
      ).then(function(res){
            if (res.data.status === 1) {
                var name = res.data.datas.user.username;
                var id = res.data.datas.user.userid;
                var token = res.data.token;
                localStorage.setItem('userName',name);
                localStorage.setItem('userId',id);
                localStorage.setItem('token',token);
                Bus.$emit("login-succ",true);
            } else {
                if (res.data.datas.count >= 3 ) {
                  self.checkImgEve();
                  self.ishidecode = true;
                }
                
            }
        })
    },
    changeLogin(){
      this.chang=!this.chang;
      this.chang2=!this.chang2;
    },
    //切换图片路径事件
    checkImgEve(){
      var self=this;
        console.log('img');
        self.Axios.Post(
        this.URL.createYZM.url).then(function(res){
        console.log(res,'img')
        self.checkImgSrc=res.data.datas;
        console.log(self.checkImgSrc);
      }).catch(function(err){
        console.log(err);
      });
    }
  },
  mounted(){
    //先执行一次获取验证码

    // this.checkImgEve();
  }
  }
</script>

<style scoped>
 
.loginCon{
    position:fixed;
    top:0;
    bottom:0;
    left:0;
    background: #fff;
    z-index: 3000;
    right:0;
   
}

 .imgTu {
    width: 100px;
    height: 100px;
    background: url(/static/images/reLogin.png) no-repeat;
    background-size: 100%;
    margin: 200px auto 20px auto;
    }     
  .loginBox{
    text-align:center;
    font-size:24px;
  }

 .login{
     position:fixed;
     left:0;
     right:0;
     top:0;
     bottom:0;
     z-index:20000;
     margin: 0 auto;
     /*width: 350px;
     height: 220px;*/
     transition: background-color 500ms linear;
     background-color: rgba(16, 16, 16, 0.5);
    font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 13px;
    color: #676a6c;
    overflow: hidden;

 }
 .loginPanel{
    z-index: 100;
    position: absolute;
    top:0;
    left:0;
    bottom:0;
    right:0;
    width: 317px;
    height: 160px;
    background-color:#fff;
    margin:auto;
 }
 .login .logo-name{
    text-align: center;
    color: #e6e6e6;
    font-size: 170px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -10px;
    margin-bottom: 0;
    /*margin-left:10px;*/
 }

 .altTip{
    text-align: center;
    line-height: 1.1;
    color: #676a6c;
    margin-top: 5px;
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 600;

    
 }




 .altDesc{
    margin-top:10px;
    margin-bottom:10px;
    text-align: center;
    font-size: 13px;
    color: #676a6c;
 }
 .loginBox button.log-button{
    background-color: #1ab394;
    border-color: #1ab394;
    color: #FFFFFF;
    border-radius: 3px;
    width:100%;
 }
.animated{
    animation-duration:1s;
    animation-fill-mode:both;
}


@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 100%, 0);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.fadeInUp {
  animation-name: fadeInUp;
}



  .section{
    position: relative;
    width: 90%;
    margin: auto;
  }
  .section .logBGIMG{
    display: block;
    width: 100%;
  }
  .log-banner{
    width: 400px;
    height: 50px;
    position: relative;
    overflow: hidden;
    margin-top: -10px;
  }
  .item-padleft .el-form-item__content{
    height: 36px;
  }

  .loginTitle{
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    line-height: 18px;
    height: 18px;
    margin-top: 15px;
    margin-left: -10px;
    padding-left: 15px;
    margin-bottom: 10px;
    float: left;
  }

  .logRemind{
    position: absolute;
    top:30px;
    left: 50%;
    margin-left: -100px;
    width: 200px;
    background-color: #ecd8d8;
    opacity: .7;
    color: #db5a36;
    font-size: 12px;
  }



  .el-input__inner{
    width: 82%;
    text-wrap: none;
  }
  .el-input__inner:focus{
    outline: none;
    border-color: #bfcbd9;
  }  
  .demo-ruleForm .el-form-item.checkPass{
    margin-bottom: 10px;
  }
  .checkPass .el-form-item__content{
    text-align: right;
  }
  .chackPa{
    width: 155px;
  }
  .checkImg{
    width: 122px;
    height: 36px;
    line-height: 36px;
    border: 1px solid  #ecd8d8;
    background-color: #ecd8d8;
    text-align: center;
    cursor: pointer;
    position: absolute;
    top:1px;
    right: 0px;
    color: #ff3535;
  }
/*8.0及以下版本的Safari不支持 animation-play-state: running; 具体原因我不能描述清楚，至此，此兼容性问题解决。*/


</style>
<style>
    .loginPanel .el-input__inner{
        background-color: rgb(250, 255, 189);
        background-image: none;
        color: rgb(0, 0, 0);
    }
    .loginPanel .el-form-item__content{
      margin-left:0px !important;
    }
    .loginPanel .el-form-item{
      margin-bottom:15px;
    }
    .loginPanel .el-input__inner{
      border-radius: 0px;
    }
    .loginPanel .password-item{
    	display: none;
    }
</style>


